programming4us
           
 
 
Programming

iPad SDK : Preparing Dudel for a New Tool (part 1) - Setting Up the GUI

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
1/11/2011 4:48:02 PM
We're going to be adding a few files to Dudel, and making changes to a few others, so now might be a good time to make a copy of your Dudel project directory. That way, you can work with the copy, and still have your previous version for reference in case something goes wrong.

1. Preparing the Controller Interface

Let's start off, as before, by dealing with the interface for our controller class. We're going to have a new button for the Text tool, so DudelViewController will get a new instance variable to point at that, as well as a new action method for the button to call. Additionally, we'll add a new font property, which the Text tool will access to figure out which font to use to draw its text. The updated DudelViewController.h looks like this (the lines shown in bold text are the new parts):

//  DudelViewController.h

#import <UIKit/UIKit.h>
#import <MessageUI/MessageUI.h>

#import "Tool.h"
#import "DudelView.h"

@interface DudelViewController : UIViewController <ToolDelegate, DudelViewDelegate, MFMailComposeViewControllerDelegate> {
id <Tool> currentTool;
IBOutlet DudelView *dudelView;
IBOutlet UIBarButtonItem *textButton;
IBOutlet UIBarButtonItem *freehandButton;
IBOutlet UIBarButtonItem *ellipseButton;
IBOutlet UIBarButtonItem *rectangleButton;
IBOutlet UIBarButtonItem *lineButton;
IBOutlet UIBarButtonItem *dotButton;
UIColor *strokeColor;
UIColor *fillColor;
CGFloat strokeWidth;
UIFont *font;

}

@property (retain, nonatomic) id <Tool> currentTool;
@property (retain, nonatomic) UIColor *strokeColor;
@property (retain, nonatomic) UIColor *fillColor;
@property (assign, nonatomic) CGFloat strokeWidth;
@property (retain, nonatomic) UIFont *font;

- (IBAction)touchTextItem:(id)sender;
- (IBAction)touchFreehandItem:(id)sender;
- (IBAction)touchEllipseItem:(id)sender;
- (IBAction)touchRectangleItem:(id)sender;
- (IBAction)touchLineItem:(id)sender;
- (IBAction)touchDotItem:(id)sender;
- (IBAction)touchSendPdfEmailItem:(id)sender;

@end

2. Setting Up the GUI

We'll also need a pair of images, normal and highlighted, for the Text tool button. Either grab these from the book's code archive or make something on your own, similar to what's shown in Table 1.

Table 1. New Buttons for the Text Tool
FilenameImage
button_text.png
button_text_selected.png

Add those to your project alongside the other button images, and then open DudelViewController.xib in Interface Builder. Make sure you can see toolbar at the bottom of the Dudel View window. Drag a new UIBarButtonItem from the Library to the toolbar, placing it to the right of the other tools, but to the left of the flexible space. Use the attribute inspector to set its Image to button_text.png and set its Style to Plain. Figure 1 shows the end result.

Figure 1. Placement of the new Text tool

Now control-drag from the new button to the File's Owner in the main .nib window, and select the touchTextItem: action from the menu that appears. Then control-drag from the File's Owner back to the button, and select the textButton outlet from the menu. That's all the GUI configuration we need to do, so you can save your work and go back to Xcode.

Other -----------------
- Coding JavaScript for Mobile Browsers (part 7)
- Coding JavaScript for Mobile Browsers (part 6)
- iPad SDK : The Structure of Core Text
- iPad SDK : PDF Generation
- jQuery 1.3 : Sorting and paging (part 5) - Finessing the sort keys
- jQuery 1.3 : Sorting and paging (part 4)
- jQuery 1.3 : Sorting and paging (part 3) - Using a comparator to sort table rows
- jQuery 1.3 : Sorting and paging (part 2) - JavaScript sorting
- jQuery 1.3 : Sorting and paging (part 1) - Server-side sorting
- Coding JavaScript for Mobile Browsers (part 5)
- Coding JavaScript for Mobile Browsers (part 4)
- Coding JavaScript for Mobile Browsers (part 3) - Writing to the document
- Coding JavaScript for Mobile Browsers (part 1) - Standard dialogs
- Coding JavaScript for Mobile Browsers (part 1) - Code Execution
- Programming the Mobile Web : JavaScript Mobile - Supported Technologies
- Security in Cloud Computing (part 4) - Audit and Compliance
- Security in Cloud Computing (part 3)
- Security in Cloud Computing (part 2) - Identity and Access Management
- Security in Cloud Computing (part 1) - Data Security and Storage
- Cloud Security and Privacy : Analyst Predictions
 
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
programming4us programming4us